define(['ajaxErrorTips'],function (ajaxErrorTips) {
    var postImgCrop=function (callback, imgSrc,cropPosition,cropSize) {
    	var cropTypeList={
    		'200x200':'courseLogo',
    		'400x400':'courseLogo'
    	}
    	var cropImgData={
    		filefullpath:imgSrc,
			x:cropPosition.x,
			y:cropPosition.y,
			w:cropPosition.w,
			h:cropPosition.h
    	}
    	cropImgData.cropType=cropTypeList[cropSize];
    	$.ajax({
			type:'post',
			dataType:'json',
			url:'/api/file/imagecrop',
			data: cropImgData,
			async:false,
			success:function(resData,statusText){
				switch(resData.status.code){
					case 0:
						callback(resData.data);
						break;
					default:
						// ajaxErrorTips({
						// 	titleText:'ServerError'.tr('common'),
						// 	contentText:resData.error_info.error,errorNo:resData.error_info.errno
						// });
				}
			},
			error:function(request,statusText,errorThrown){
				ajaxErrorTips({
					From:'imgResize',
					StatusText:statusText,
					ErrorThrown:errorThrown,
					RequestStatus:request.status,
					RequestStatusText:request.statusText
				});
			},
			complete:function(request,statusText){
				//console.log(request,statusText);
			}
		});
    }
    return postImgCrop

})
